<?php
/*
php标准格式；
学习模板！
*/
header("content-type:text/html;charset=UTF-8");
$m_id = is_numeric($_POST["_id"]) ? $_POST["_id"] : null;
$m_chinese = is_numeric($_POST["_chinese"]) ? $_POST["_chinese"] :null;
$m_math = is_numeric($_POST["_math"]) ? $_POST["_math"] : null;
$m_name = is_null($_POST["_math"]) ? null : $_POST["_name"];
$m_english = is_numeric($_POST["_english"]) ? $_POST["_english"] : null;
if($m_id==null || $m_chinese==null || $m_math==null || $m_name==null || $m_english==null)
{
	echo "<script type ='text/javascript'>
	alert('非法的数据提交!');
	location.href='admin.php';
	</script>";
}
  require 'connect.php';
  $sql = "update students set chinese={$m_chinese},math={$m_math},english={$m_english} where id={$m_id} and name='{$m_name}';";
  //var_dump($sql);
  $ret_que = mysql_query($sql);
  if($ret_que)
  {
  	echo "<script type ='text/javascript'>
	alert('修改成功!');
	location.href='admin.php';
	</script>";
  }else
  {
  	echo "<script type ='text/javascript'>
	alert('修改失败!');
	location.href='admin.php';
	</script>";
  }
?>
